import requests

# 设置API的URL
url = "http://172.16.1.203:11434/api/chat"

# 构建请求的数据
data = {
   "model": "qwen2.5:32b",
   "messages": [
       {
           "role": "system",
           "content": "你作为一个数据核查人员 再输入的数据中如果有 \"发送数据给NCC'\"  这的关键词打印正行数据"
       },
       {
           "role": "user",
           "content": "请检查数据\n aaa\n aaa\n  送数据给NCC：token:"
       }
   ],
   "stream": False
}

try:
    # 发送POST请求
    response = requests.post(url, json=data)
    
    # 检查响应状态码
    if response.status_code == 200:
        # 获取响应的JSON数据
        response_data = response.json()
        
        # 提取并打印content字段的内容
        if 'message' in response_data and 'content' in response_data['message']:
            content = response_data['message']['content']
            print(content)
        else:
            print("响应数据中没有找到content字段")
    else:
        print(f"请求失败，状态码: {response.status_code}")
except requests.exceptions.RequestException as e:
    print(f"请求过程中发ssssss生错误aaaaaaaa: {e}")
